


function jumpOpenName(flowId,step,runId,realPrcsId) {
    window.open('/workflow/work/workformPreView?flowId='+flowId+'&flowStep='+step+'&runId='+runId+'&prcsId='+realPrcsId);
}
function jumpOpenType(flowId,type) {
    window.open('/flowSetting/processDesignToolsT?flowId='+flowId+'&type='+type);
}

function jumpOpenStep(flowId,runId,me) {
    eventas=$(me).parent().parent().find('.wenhaoTwo');
    window.open('/flowSetting/processDesignToolTwo?flowId='+flowId+'&rilwId='+runId);
}
//编辑
$(document).on("click",".editAndDelete0",function(data){
    var dataObject=pageObj.arrs[$(this).attr('data-i')]
    window.open('/reportSettings/newReport?rId='+dataObject.rId)
})
$(document).on('click','.editAndDelete1',function () {//权限设置
    var obj=pageObj.arrs[$(this).attr('data-i')];
    var str='';
    var rId = obj.rId;
    self.parent.document.getElementById('iframe').src='/reportSettings/qxSetting?rId='+rId;
})



$(document).on('click','.editAndDelete2',function () {//删除
    var obj=pageObj.arrs[$(this).attr('data-i')];
    //询问框
    layer.confirm(qued,{title:xinxiM,
        btn: [sure, cancel] ,//按钮
    }, function(){
        $.ajax({
            type:'post',
            data:{
                rId:obj.rId
            },
            url:'/reportSettings/deleteReportSettings',
            dataType:'json',
            success:function(res){
                if (res.flag) {
                    $.layerMsg({content: delc, icon: 1});
                    pageObj.init();
                } else {
                    $.layerMsg({content: delf, icon: 2});
                }

            }
        })
    }, function(){
        layer.closeAll();
    });
})


//流程分类递归
function queryChild_flow(datas,str_li,level){
    for(var i=0;i<datas.length;i++){

        var className="levelleft"+level;
        if(datas[i].sortName=='未定义'){
            str_li+='<option value="'+datas[i].sortNo+'">'+datas[i].sortName+'</option>'
        }else{
            str_li+='<option value="'+datas[i].sortNo+'">'+datas[i].sortName+'</option>'
        }

        /*   console.log(datas[i].childs); */
        if(datas[i].childs!=null){
            str_li = queryChild_flow(datas[i].childs,str_li,level+1);
        }
    }
    return str_li;
}
$(function(){
    // pageObj.init();
    $("#addUser").on("click",function(){
        user_id='user';
        $.popWindow("../../common/selectUser?0");
    });
    $("#clearUser").on("click",function(){
        $("#user").val("");
        $("#user").attr('user_id','');
    })
//    点击查询
    $('#query').click(function(){
        if($('[name="flowName"]').val()==""){
            $('[name="flowName"]').attr('dataType',"")
        }
        console.log($('[name="tableName"]').val())
        pageObj.data.flowId=$('[name="flowName"]').attr('dataType');
        pageObj.data.rName=$('[name="tableName"]').val();
        pageObj.init();
    })

    $("#outport").click(function () {
        if($('[name="flowName"]').val()==""){
            $('[name="flowName"]').attr('dataType','0')
        }
        window.location.href='../../workflow/work/monitoring?output=1&flowId='+$('[name="flowName"]').attr('dataType')
            +'&runId='+$('[name="runId"]').val()+'&runName='+$('[name="runName"]').val()
            +'&workLevel='+$('[name="workLevel"]').val()+'&status='+$('[name="status"]').val()
            +'&userId='+$('[name="userId"]').attr("user_Id");
    })

})